﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Caching;

namespace BusinessLogic.StateManagers
{
    public static class CacheManager
    {
        private static Cache cache = HttpContext.Current.Cache;
        public static List<object> LatestComments
        {
            get { return (List<object>)cache["LatestComments"]; }
            set 
            {
                cache.Add(
                    "LatestComments",
                    value,
                    null,
                    DateTime.Now.AddMinutes(60),
                    System.Web.Caching.Cache.NoSlidingExpiration,
                    System.Web.Caching.CacheItemPriority.Default,
                    null);
            }
        }

        public static void RemoveLatestComments()
        {
            cache.Remove("LatestComments");
        }
    }
}
